package hu.mapro.gwtui.shared.data;

import com.google.common.base.Supplier;

public final class ClassDataFactorySupplier<T> implements
		Supplier<T> {
	private final ClassDataFactory cdf;
	private final Class<T> clazz;

	public ClassDataFactorySupplier(ClassDataFactory cdf, Class<T> clazz) {
		this.cdf = cdf;
		this.clazz = clazz;
	}

	@Override
	public T get() {
		return cdf.create(clazz);
	}
	
	public static <T> Supplier<T> create(final ClassDataFactory cdf, final Class<T> clazz) {
		return new ClassDataFactorySupplier<T>(cdf, clazz);
	}
	
}